<%--
 *  File:    DMSLevel.jsp
 *  @Author: KentZhong 
 *  Date:    2009-10-9 10:02:44
 *
 *  Copyright (C) 2000 - 2009 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>


<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<%

  String strTableName = "";
  String strModuleName = "COM";
   String privilegeCode = "FP0201";
  
	String contextPath = request.getContextPath();
%>

<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<html>
<head>
<title>VisitPlanFeedbackDetail</title>

<PageFlow:CheckPageFlow pageName="p_mdslevel"/>
<%
String mdsid = "";
if (pageContext.getAttribute("mdsid")!= null )
	mdsid = pageContext.getAttribute("mdsid").toString();

String flag = (String)pageContext.getAttribute("flag");
if(flag == null) flag = new String("");

     String viewflag = "";

     if(pageContext.getAttribute("viewflag") != null&&((String)pageContext.getAttribute("viewflag")).equals("view")) {

           viewflag = "view";
     }
     String strIsDefault = null;

  Vector details = (Vector)pageContext.getAttribute("details");
  if(details == null) details = new Vector();
  Vector allnotusedfields=(Vector)pageContext.getAttribute("allfields");
  if(allnotusedfields == null) allnotusedfields = new Vector();
  String disabled = "disabled";
  String strIsCheckNeed = new String("");
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/Calendar.js"></script>

<script language="JavaScript">


function page_add()
{

   if(!checkForm(cform))   return;
    if(document.cform.limitchackflag.checked)
  	{
    	document.cform.limitflag.value = "Y";
  	}
  	else
  	{
    	document.cform.limitflag.value = "N";  
  	}
    cform.actionname.value = "add";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_delete()
{
    if(isNullChecked(cform.deleteids))
    {
        alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
        return;
    }
    if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
    
    cform.actionname.value = "delete";


    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_save()
{
    if(!checkALLElems(document.getElementById("olddetail"))) return;
    cform.actionname.value = "save";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_back()
{  
  parent.location.href = "MDSManagement.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode%><%=JspHelper.filterNull( strIsDefault )%>";
}

function allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var alldatafile = document.getElementsByName('deleteids');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = false;
		}	
	}
}

</script>
</head>
<body>
	<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_mdslevel">
    <input type="hidden" name="actionname">
   <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">
    <table width="100%" cellspacing="0" border="0" cellpadding="0">     



      <%   HashMap detailinfo=(HashMap)pageContext.getAttribute("mdslevelinfo");
          	if(detailinfo==null)
          		detailinfo=new HashMap();
          	
      %>

       <tr>
        <td>
          <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
<%	if(!viewflag.equals("view")){%>
                    <tr>
                        <td colspan="20" class="td_right">
                          <a onclick="page_add();"><custom:button type="2" label="L_Add" imgsrc="add_btn.gif" border="0"/></a>
                        <%if(details.size()>0 ){%>
                          <a onclick="page_delete();"><custom:button type="2" label="L_Delete" imgsrc="delete_btn.gif" border="0"/></a>
                          <%}%>
                        </td>
                      </tr>
<%}%>			
			<tr class="deepblue-left">
			<td width="22" class="title_center">
			<input type="checkbox" name="allcheck" class="normalradio" onclick="allcheckselect();"></td>
			<td  class="title_center"><%= label.getLabelName("L_Num")%><font color="red">*</font></td>
            <td  class="title_center"><%= label.getLabelName("L_LevelName")%></td>
			<td  class="title_center"><%= label.getLabelName("L_PlanLevel")%><font color="red">*</font></td>
            <td  class="title_center"><%= label.getLabelName("L_Description")%></td>
            <td  class="title_center"><%= label.getLabelName("L_AllocateQuota")%><font color="red">*</font></td>

            <td  class="title_center"><%= label.getLabelName("L_LIMITFLAG")%></td>
		</tr>
		
<span id="olddetail" >

              <logic:iterate id="onerow" collection="<%= details %>" indexId="idx">
                      <tr>
  						<td width="30">
                   		<custom:checkbox  property="mdslevelid" name="onerow" changedName="deleteids" styleClass="normalradio" />
                   
                        </td>
                        <td>&nbsp;<custom:write property="serialnum" name="onerow"/></td>
                        <td>&nbsp;<custom:write property="levelname" name="onerow"/></td>
                        <td>&nbsp;<custom:write property="planlevelname" name="onerow"/></td>
						<td>&nbsp;<custom:write property="comments" name="onerow"/></td>
						<td>&nbsp;<custom:write property="limitper" name="onerow"/></td>
                        <td>&nbsp;<custom:write property="limitflag" name="onerow"/></td>
  						<custom:hidden property="mdslevelid" name="onerow" colIndex="<%=idx%>"/>
                       
                   </tr>
                
            </logic:iterate>
</span>

<%	if(!viewflag.equals("view")){%>
<span id="newdetail" >
                      <tr >               
						<td width="22" class="title_center"><custom:hidden property="mdslevelid"/>&nbsp;</td>
                        <td>&nbsp;<custom:text property="serialnum" name="newdetail" command="notnull" dataType="integer" label="L_Num"/></td>
                        <td>&nbsp;<custom:text property="levelname" name="newdetail"/></td>
                        <td><custom:select property="planlevel" optionsName="planlevelname"
							optionValueKey="value" optionInnerTextKey="valuename" defaultValue="--------" command="notnull"/></td>

						
						<td>&nbsp;<custom:text property="comments" name="newdetail"/></td>
						<td>&nbsp;<custom:text property="limitper" name="newdetail" command="notnull" dataType="double" label="L_AllocateQuota"/></td>
                        <td><input type="checkbox" name="limitchackflag" class="normalradio" <%=JspHelper.filterNull( strIsCheckNeed )%>></td>

                      </tr>

                      <tr>
                        <td style="display:none">
                            
                            <custom:hidden property="mdsid"  value="<%= mdsid %>"/>
                             <custom:hidden property="limitflag"  />
                            
                        </td>
                      </tr>
</span>
   <%}%>   
          </table>
         </td>
       </tr>  

      <tr>
      	<td>
      		<table width="100%" cellspacing="0" cellpadding="0">
            <tr>
            	<td class="summary_top">
            	</td>
            </tr>
            <tr>
              <td class="td_center">
					<a onclick="page_back();"><custom:button type="1" label="L_Back" imgsrc="new.gif" border="0" style="width:60"/></a>
          
              </td>
            </tr>
          </table>  
        </td>
      </tr>
    </table>
  </form>             	
</body>

</html>
	
